/*
 * Copyright (C) 2017 Pingan, Inc. All Rights Reserved.
 */

package com.pingan.haofang.searchcloud.common.configuration;

import com.pingan.haofang.searchcloud.api.constants.EngineType;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 集群配置
 *
 * @author zhangbi617
 * @date 2017-07-19
 */
@Component
@ConfigurationProperties(prefix = "searchcloud.cluster")
public class ClusterProperties {

    private List<ClusterInfo> servers = new ArrayList<>();

    public List<ClusterInfo> getServers() {
        return servers;
    }

    public void setServers(List<ClusterInfo> servers) {
        this.servers = servers;
    }

    public static class ClusterInfo {
        private EngineType engineType;
        private String name;
        private String description;
        private String host;
        // 是否允许创建，默认允许
        private boolean disableCreate = false;
        /**
         * 允许创建的项目
         */
        private List<Long> allowProjects = new ArrayList<>();

        public EngineType getEngineType() {
            return engineType;
        }

        public void setEngineType(EngineType engineType) {
            this.engineType = engineType;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getHost() {
            return host;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public void setHost(String host) {
            this.host = host;
        }

        public boolean isDisableCreate() {
            return disableCreate;
        }

        public void setDisableCreate(boolean disableCreate) {
            this.disableCreate = disableCreate;
        }

        public List<Long> getAllowProjects() {
            return allowProjects;
        }

        public void setAllowProjects(List<Long> allowProjects) {
            this.allowProjects = allowProjects;
        }

    }
}
